﻿package net.wangit.framework.action;

import javax.servlet.http.HttpServletResponse;

import net.wangit.context.ActionContextHelper;
import net.wangit.context.LocalContext;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


@SuppressWarnings("serial")
public class RedirectActionResult extends AbstractActionResult {

	private static final Log log = LogFactory
			.getLog(net.wangit.framework.action.RedirectActionResult.class);

	public RedirectActionResult() {
	}

	public void execute() throws Exception {
		HttpServletResponse response = LocalContext.getLocalContext()
				.getHttpServletResponse();
		if (log.isDebugEnabled())
			log.debug((new StringBuilder("Redirecting to location ")).append(
					url).toString());
		ActionContextHelper.update();
		response.sendRedirect(url);
	}

}
